package com.spring.cloud.weather.report.service;

import com.spring.cloud.weather.report.vo.Weather;
import com.spring.cloud.weather.report.vo.WeatherResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Administrator on 2018/3/17
 */
@Service
public class WeatherReportServiceImpl implements WeatherReportService {

    @Autowired
    private DataClient dataClient;

    /**
     * 根据城市ID查询天气信息
     *
     * @param cityId cityId
     * @return Weather
     */
    @Override
    public Weather getDataByCityId(String cityId) {
        WeatherResponse response = dataClient.getWeatherByCityId(cityId);
        return response != null ? dataClient.getWeatherByCityId(cityId).getData() : null;
    }
}
